
#ifndef __EPOLL_MODEL_H__
#define __EPOLL_MODEL_H__

#include "define.h"
#include "io_model.h"
#include "utils.h"
#include <sys/epoll.h>
#include "confMgr.h"

extern confMgr *conf;

/*epoll的上下文;
 *
 */
typedef struct epoll_ctx{
	int epollfd;
	struct epoll_event  *events;
	int timeout; //超时时间;
	int maxsize;
}EPOLL_CTX;



//epoll类;
class epollModel:public ioModel
{
	public:
		epollModel();
		~epollModel();
		int init();
		int addEvent(int fd);
		int addEvent(void *arg,int type);
		int delEvent(void *arg);
		int waitForEvent();
		void *getIoCtx(){ return &ctx; };
		std::string & getIoName(){ return this->ioname; }
	private:
		EPOLL_CTX ctx;
		std::string ioname;
		MemPool mem;
};



#endif 
